package com.erb.service.wzq.impl;

import com.erb.entity.*;
import com.erb.mapper.PersonalMapper;
import com.erb.service.wzq.IPersonalService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by MoYao on 2020/6/11.
 */
@Service
public class PersonalServiceImpl implements IPersonalService {

	@Resource
	private PersonalMapper pm;

	@Override
	public Integer countinf(Integer id, Integer readed) {
		return pm.infcount(id, readed);
	}

	@Override
	public Thirdparty selthi(Integer uid) {
		return pm.thisel(uid);
	}

	@Override
	public Integer selinvest(Integer uid) {
		return pm.investsel(uid);
	}

	@Override
	public Integer selinvest2(Integer uid) {
		return pm.investsel2(uid);
	}

	@Override
	public Map investuser(Integer id) {
		return pm.userinvest(id);
	}

	@Override
	public Map investuser2(Integer uid) {
		return pm.userinvest2(uid);
	}

	@Override
	public Integer count2invest(Integer uid, Integer tkey, String date1, String date2) {
		return pm.invest2count(uid, tkey, date1, date2);
	}

	@Override
	public List<Invest> page2invest(Pager pager, Integer uid, Integer tkey, String date1, String date2) {
		return pm.invest2page((pager.currPage - 1) * pager.pageSize, pager.pageSize, uid, tkey, date1, date2);
	}

	@Override
	public Integer countinvest(Integer uid) {
		return pm.investcount(uid);
	}

	@Override
	public List<Invest> pageinvest(Pager pager, Integer uid) {
		return pm.investpage((pager.currPage - 1) * pager.pageSize, pager.pageSize, uid);
	}

	@Override
	public boolean updsuser(Integer id, String face) {
		Integer i = pm.userupds(id, face);
		return i > 0;
	}

	@Override
	public Integer updname(Integer id, String name) {
		return pm.nameupd(id, name);
	}

	@Override
	public Map investmentsum(Integer id) {
		return pm.suminvestment(id);
	}

	@Override
	public Map profitsum(Integer id) {
		return pm.sumprofit(id);
	}

	@Override
	public Map investmentssum(Integer id) {
		return pm.sumsinvestment(id);
	}

	@Override
	public Integer countsinvest(Integer uid, Integer status) {
		return pm.investcounts(uid, status);
	}

	@Override
	public List<Invest> pagesinvest(Pager pager, Integer uid, Integer status) {
		return pm.investpages((pager.currPage - 1) * pager.pageSize, pager.pageSize, uid, status);
	}

	@Override
	public void updinvest(Integer id) {
		pm.investupd(id);
	}

	@Override
	public void addthi(Thirdparty thirdparty) {
		pm.thiadd(thirdparty);
	}

	@Override
	public void updusers(Integer uid, String sex) {
		pm.usersupd(uid, sex);
	}

	@Override
	public Thirdparty selthis(Integer uid, Integer pwd) {
		return pm.thisels(uid, pwd);
	}

	@Override
	public User seluser(Integer id) {
		return pm.usersel(id);
	}

	@Override
	public void upduser(Integer id, double balance) {
		pm.userupd(id, balance);
	}

	@Override
	public List<Bankcard> listban(Integer uid) {
		return pm.banlist(uid);
	}

	@Override
	public Boolean addban(Bankcard bankcard) {
		return pm.banadd(bankcard) > 0;
	}

	@Override
	public void addcap(CapitalLog capitalLog) {
		pm.capadd(capitalLog);
	}

	@Override
	public Redenvelopes selred(String exchangeCode) {
		return pm.redsel(exchangeCode);
	}

	@Override
	public Redpacketrecord selredp(Integer uid, String exchangeCode) {
		return pm.redpsel(uid, exchangeCode);
	}

	@Override
	public String datered(String exchangeCode) {
		return pm.reddate(exchangeCode);
	}

	@Override
	public void addredp(Redpacketrecord redpacketrecord) {
		pm.redpadd(redpacketrecord);
	}

	@Override
	public Integer countredp(Integer uid, Integer state) {
		return pm.redpcount(uid, state);
	}

	@Override
	public List<Redpacketrecord> pageredp(Pager pager, Integer uid, Integer state) {
		return pm.redppage((pager.currPage - 1) * pager.pageSize, pager.pageSize, uid, state);
	}

	@Override
	public List<Redpacketrecord> listredpa() {
		return pm.redpalist();
	}

	@Override
	public void updredp(Integer id, Integer state) {
		pm.redpupd(id, state);
	}

	@Override
	public List<Inform> pageinf(Pager pager, Integer informRecipientsId, Integer readed) {
		return pm.infpage((pager.currPage - 1) * pager.pageSize, pager.pageSize, informRecipientsId, readed);
	}

	@Override
	public Inform selinfr(Integer informId, Integer informRecipientsId) {
		return pm.infrsel(informId, informRecipientsId);
	}

	@Override
	public void updinf(Integer informId, boolean readed) {
		pm.infupd(informId, readed);
	}

	@Override
	public List<User> listuser() {
		return pm.userlist();
	}

	@Override
	public void updmod(Integer id, Integer modificationTime) {
		pm.modupd(id, modificationTime);
	}
}
